import request from '@/utils/request'

/** 获取下级 */
export const AreaSubs = (parentId:number):  Promise<ServiceResponse<RegionData[]>> => request({ url: `file/region/subs/${parentId}`, method: 'GET',loading: false })
/** 获取下级 */
export const GetAreaList = (id: number, level: number ): Promise<ServiceResponse<RegionData>> => request({ url: 'file/region/list', data: {id, level}, method: 'GET' })
/** 添加 */
export const AreaCreate = (name: string, parentId: number): Promise<ServiceResponse<any>> => request({ url: 'file/region/create', data: {name,parentId },  method: 'GET' })
/** 编辑 */
export const AreaSave = (id:number, name: string): Promise<ServiceResponse<any>>  => request({ url: 'file/region/save', data: {id,name},  method: 'GET' })
/** 删除 */
export const AreaDelete = (id:number): Promise<ServiceResponse<any>> => request({ url: `file/region/${id}`,   method: 'DELETE' })
/** 获取地区文件 */
export const AreaFile = (): Promise<ServiceResponse<any>> => request({ url: 'file/region/file', method: 'GET' })
/** 获取详情 */
export const GetAreaDetails =(id:number) => request({ url: `file/region/${id}`,  method: 'GET',loading: false })